<template>
    <div>
        <h1>我是哥哥,我开的车是{{car}}</h1>
        <button @click="changeCar">找了个大我30岁的女朋友给我换车了</button>
    </div>
</template>



<script>
import PubSub from "pubsub-js"
export default {
    name:"Gege",
    data(){
        return{
            car:"二手法拉利"
        };
    },
    methods:{
        changeCar(){
            this.car="新款兰博基尼";
            PubSub.publish("getCar",this.car)
        }
    }
}
</script>